package com.ruoyi.framework.config;

import com.ruoyi.framework.interceptor.LoginUserHandlerMethodArgumentResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.List;


@Configuration
public class LoginUserConfig extends WebMvcConfigurerAdapter {

    /**
     * 此处获取拦截器实例化对象
     * @return
     */
    @Bean
    public LoginUserHandlerMethodArgumentResolver getLoginUserHandlerMethodArgumentResolver(){
        return new LoginUserHandlerMethodArgumentResolver();
    }

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers){
        super.addArgumentResolvers(argumentResolvers);
        argumentResolvers.add(getLoginUserHandlerMethodArgumentResolver());
    }
}
